
/*
 * Hlpay-Plus aggregate payment system. Copyright
 * (c) 2022-2023 Hlpay Team Copyright has the right of final interpretation.
 */
package com.hlkj.pay.service.admin;

import java.util.List;

import com.hlkj.framework.common.pojo.PageResult;
import com.hlkj.pay.dto.admin.AdminUserDto;
import com.hlkj.pay.dto.admin.AdminUserQueryDto;
import com.hlkj.pay.dto.merchant.MerchantInfoRegisterDto;
import com.hlkj.pay.enums.CommonEnum;
import com.hlkj.pay.infrastructure.model.admin.AdminUserDO;
import com.hlkj.pay.infrastructure.model.admin.AdminUserRoleMappingDO;

/**
 * @author HlpayTeam
 * @date 2024/09/03 14:17
 */
public interface IAdminUserService {

    /**
     * 分页查询
     * @param adminUserQueryDto
     * @return
     */
    PageResult<AdminUserDto> queryUserPage(AdminUserQueryDto adminUserQueryDto);

    /**
     * queryUserById
     * @param adminUserQueryDto
     * @return
     */
    List<AdminUserDto> queryUserList(AdminUserQueryDto adminUserQueryDto);
    /**
     * queryUserById
     * @param userIds
     * @return
     */
    List<AdminUserDO> queryUserList(List<Long> userIds);

    List<AdminUserRoleMappingDO> queryUserRoles(Long userId);

    /**
     * 用户详情
     * @param userId
     * @return
     */
    AdminUserDto queryUserDto(Long userId);

    /**
     * 更新/增加用户
     * @param adminUserDO
     * @return
     * @throws Exception
     */
    Long addUser(AdminUserDO adminUserDO) throws Exception;

    /**
     * 更新/增加用户
     * @param adminUserDO
     * @throws Exception
     */
    void updateUser(AdminUserDO adminUserDO) throws Exception;

    /**
     * deleteUser
     * @param userId
     */
    void deleteUser(Long userId);

    /**
     * assignUserRole
     * @param userId
     * @param roleCodes
     */
    void assignUserRole(Long userId, List<String> roleCodes);

    /**
     * updatePwd
     * @param userId
     * @param language
     * @throws Exception
     */
    void updateLanguage(Long userId, String language) throws Exception;
    /**
     * updatePwd
     * @param userId
     * @param pwd
     * @param updatePwdFlag
     * @throws Exception
     */
    void updatePwd(Long userId, String pwd, CommonEnum.YES_NO_TYPE updatePwdFlag) throws Exception;
    /**
     * updatePwd
     * @param userId
     * @param pwd
     * @param updatePwdFlag
     * @throws Exception
     */
    void updatePwd(Long userId, String pwd,Integer checkAgreement,CommonEnum.YES_NO_TYPE updatePwdFlag) throws Exception;

    /**
     * updateStatus
     * @param userId
     * @param status
     */
    void updateStatus(Long userId, Integer status);


    /**
     * queryUserByEmail
     * @param email
     * @return
     * @throws Exception
     */
    AdminUserDto queryUserByEmail(String email,Integer sysType) throws Exception;

    /**
     * queryUserByPhone
     * @param phone
     * @return
     * @throws Exception
     */
    AdminUserDto queryUserByPhone(String phone,Integer sysType) throws Exception;
    /**
     * queryUserByPhone
     * @param account
     * @return
     * @throws Exception
     */
    AdminUserDto queryUserByAccount(String account) ;
    /**
     * queryUserByPhone
     * @param account
     * @return
     * @throws Exception
     */
    AdminUserDto queryUserByAccount(String account,Integer sysType) throws Exception;
    /**
     * queryUserBySn
     * @param sn
     * @return
     * @throws Exception
     */
    AdminUserDO queryUserBySn(String sn) ;
    /**
     * queryUserBySn
     * @param userId
     * @return
     * @throws Exception
     */
    AdminUserDO queryUser(Long userId);

    /**
     * updateUserLoginTime
     * @param userId
     */
    void updateUserLoginTime(Long userId,Integer checkAgreement);


    /**
     * 登录状态
     * @return
     */
    boolean permissionChangeStatus();

    /**
     * 增加登录状态
     * @return
     */
    void expirePermissionChangeStatus();

    /**
     * 删除登录用户缓存
     * @return
     */
    void delLogInUserCache();
    /**
     * 角色变更 涉及用户登出
     * @param roleCode
     * @param delUserRoleRelation
     */
    List<Long> roleChangeUser(String roleCode, Boolean delUserRoleRelation);
    /**
     * 生成默认用户
     * @param merchantInfoRegisterDto
     */
	void addMerchantUser(MerchantInfoRegisterDto merchantInfoRegisterDto);
    /**
     * 生成默认用户
     * @param sn
     */
	void updateMerchantUserRole(String sn);
    /**
     *
     * @param userIds
     * @param code
     */
    void updateUserTeams(List<Long> userIds, String code);

    /**
     * queryUserById
     * @return
     */
    List<AdminUserDto> querySysUserList();
}
